/*
 * mem_file.h
 *
 *  Created on: Feb 16, 2013
 *      Author: redchen
 */

#ifndef MEM_FILE_H_
#define MEM_FILE_H_

#include <lfs.h>
#include <buffer.h>

typedef struct _MemFile_ MemFile;

typedef enum
{
    MEM_FILE_NORMAL,
    MEM_FILE_BLOCK
} MemFileType;

//init

MemFile* mem_file_create(const char* namespace, MemFileType type, int32_t size);

//write

int mem_file_wirte(MemFile* file, void* data, int32_t size);

//read

int mem_file_read(MemFile* file, int64_t start, int64_t end, /*out*/Buffer* buf);

//free

void mem_file_destory(MemFile* file);

#endif /* MEM_FILE_H_ */
